<!DOCTYPE html>
<html lang="en">
<head>
  <title>登录确认</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1">
  <link href="https://res.wx.qq.com/t/wx_fed/weui-source/res/2.6.16/weui.min.css" rel="stylesheet">
</head>

<body data-weui-theme="light">
  <div class="page">
    <div class="weui-msg" id="confirmLogin">
      <div class="weui-msg__icon-area">
        <svg xmlns="http://www.w3.org/2000/svg" width="181" height="76" viewBox="0 0 181 76" fill="none">
          <path fill="#fff" d="M0 0h181v76H0z" />
          <path opacity=".8" d="M0 20a6 6 0 0 1 6-6h19a6 6 0 0 1 6 6v36a6 6 0 0 1-6 6H6a6 6 0 0 1-6-6V20z"
            fill="#75A8FE" />
          <path d="M3 22a3 3 0 0 1 3-3h19a3 3 0 0 1 3 3v34a3 3 0 0 1-3 3H6a3 3 0 0 1-3-3V22z" fill="#fff" />
          <path
            d="M10.332 35.334a.76.76 0 0 1-.766-.753.76.76 0 0 1 .766-.754.76.76 0 0 1 .766.754.76.76 0 0 1-.766.753zm4.74-1.507a.76.76 0 0 1 .766.754.76.76 0 0 1-.766.753.76.76 0 0 1-.767-.753.76.76 0 0 1 .767-.754zm3.378 1.385c-.631-2.158-2.916-3.758-5.638-3.758C9.602 31.454 7 33.678 7 36.42c0 1.555.835 2.942 2.144 3.852.224.156-.556 1.28-.556 1.28s1.834-.596 2.135-.497a6.685 6.685 0 0 0 1.8.32 4.752 4.752 0 0 1-.12-1.055c0-2.889 2.681-5.06 6.047-5.11v.002zm1.736 4.081a.641.641 0 0 1-.647-.635c0-.351.29-.637.647-.637.357 0 .646.285.646.637a.64.64 0 0 1-.646.636zm-4.004 0a.641.641 0 0 1-.646-.635c0-.351.29-.637.646-.637.357 0 .648.285.648.637 0 .352-.29.636-.648.636zm6.818.918c0-2.317-2.198-4.194-4.909-4.194-2.71 0-4.91 1.877-4.91 4.194 0 2.316 2.199 4.195 4.91 4.195a5.65 5.65 0 0 0 1.765-.28c.255-.084 1.802.42 1.802.42s-.658-.95-.469-1.081C22.294 42.695 23 41.524 23 40.21z"
            fill="#74C452" />
          <path d="M10 14h11v1a2 2 0 0 1-2 2h-7a2 2 0 0 1-2-2v-1z" fill="#729FFE" />
          <path opacity=".8" fill-rule="evenodd" clip-rule="evenodd"
            d="M146 66h-13v4h-8a3 3 0 1 0 0 6h29a3 3 0 1 0 0-6h-8v-4z" fill="#4F87FE" />
          <path opacity=".8" d="M97 8a8 8 0 0 1 8-8h68a8 8 0 0 1 8 8v50a8 8 0 0 1-8 8h-68a8 8 0 0 1-8-8V8z"
            fill="#A8C8FE" />
          <rect x="102" y="5" width="74" height="56" rx="4" fill="#fff" />
          <rect x="124" y="48" width="29" height="3" rx="1.5" fill="#DBE9FA" />
          <rect x="118" y="40" width="41" height="3" rx="1.5" fill="#DBE9FA" />
          <circle cx="35.5" cy="37.5" r="1.5" fill="#D9D9D9" />
          <circle cx="42.5" cy="37.5" r="1.5" fill="#D9D9D9" />
          <circle cx="49.5" cy="37.5" r="1.5" fill="#D9D9D9" />
          <circle cx="70.5" cy="37.5" r="1.5" fill="#D9D9D9" />
          <circle cx="77.5" cy="37.5" r="1.5" fill="#D9D9D9" />
          <circle cx="84.5" cy="37.5" r="1.5" fill="#D9D9D9" />
          <circle cx="91.5" cy="37.5" r="1.5" fill="#D9D9D9" />
          <g clip-path="url(#f)">
            <path d="M64 46a8 8 0 1 0 0-16 8 8 0 0 0 0 16z" fill="#65AB48" />
            <path fill-rule="evenodd" clip-rule="evenodd"
              d="M68.601 35.199a.85.85 0 0 1 0 1.202l-4.82 4.82a.85.85 0 0 1-1.201 0l-2.68-2.68a.85.85 0 0 1 1.201-1.202l2.08 2.079 4.218-4.22a.85.85 0 0 1 1.202 0z"
              fill="#fff" />
          </g>
          <defs>
            <linearGradient id="b" x1="145.217" y1="16.594" x2="145.217" y2="32.156" gradientUnits="userSpaceOnUse">
              <stop stop-color="#FF1C1F" />
              <stop offset="1" stop-color="#FF4A04" />
            </linearGradient>
            <linearGradient id="c" x1="143.194" y1="17.883" x2="146.85" y2="19.692" gradientUnits="userSpaceOnUse">
              <stop stop-color="#BD0000" />
              <stop offset=".771" stop-color="#BD0000" stop-opacity="0" />
            </linearGradient>
            <linearGradient id="d" x1="135.961" y1="16.594" x2="135.961" y2="32.156" gradientUnits="userSpaceOnUse">
              <stop stop-color="#FF1C1F" />
              <stop offset="1" stop-color="#FF4A04" />
            </linearGradient>
            <linearGradient id="e" x1="140.492" y1="16.594" x2="140.492" y2="23.391" gradientUnits="userSpaceOnUse">
              <stop stop-color="#FF9825" />
              <stop offset="1" stop-color="#FF9825" stop-opacity="0" />
            </linearGradient>
            <clipPath id="a">
              <path fill="#fff" transform="translate(127 12)" d="M0 0h24v24H0z" />
            </clipPath>
            <clipPath id="f">
              <path fill="#fff" transform="translate(56 30)" d="M0 0h16v16H0z" />
            </clipPath>
          </defs>
        </svg>
      </div>
      <div class="weui-msg__text-area">
        <h4 class="weui-msg__title">使用该微信授权登录</h4>
      </div>
      <div class="weui-msg__opr-area">
        <p class="weui-btn-area">
          <a href="javascript:" role="button" class="weui-btn weui-btn_primary" id="login">登录</a>
        </p>
      </div>
    </div>

    <div class="weui-msg" id="loginSuccess" style="display: none;">
      <div class="weui-msg__icon-area"><i class="weui-icon-success weui-icon_msg"></i></div>
      <div class="weui-msg__text-area">
        <h4 class="weui-msg__title">已成功登录</h4>
      </div>
      <div class="weui-msg__opr-area">
        <p class="weui-btn-area">
          <a href="javascript:" id="homepage" role="button" style="color: var(--weui-BRAND);"
            class="weui-btn weui-btn_default weui-btn_medium">我知道了</a>
        </p>
      </div>
    </div>
  </div>

  <div role="alert" id="textToast" style="display: none;">
    <div class="weui-mask_transparent"></div>
    <div class="weui-toast weui-toast_text">
      <p class="weui-toast__content" id="toast_text"></p>
    </div>
  </div>
</body>

<script src="https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript">
  var param = {
    'key': '[[${key}]]'
  };
  function showToast (msg) {
    var $textToast = $('#textToast');
    if ($textToast.css('display') != 'none') return;
    $("#toast_text").text(msg);
    $textToast.fadeIn(100);
    setTimeout(function () {
      $textToast.fadeOut(100);
    }, 2000);
  }

  function login () {
    $.ajax({
      type: 'POST',
      url: "[[${baseUrl}]]/user/login_confirm",
      data: JSON.stringify(param),
      headers: {
        "Authorization": "[[${token}]]"
      },
      contentType: 'application/json; charset=UTF-8',
      dataType: 'json',
      success: function (res) {
        if (res.code === 200) {
          $("#confirmLogin").css("display", 'none');
          $("#loginSuccess").css("display", 'block');
        } else {
          showToast(res.message);
        }
      },
      error: function (error) {
      }
    })
  }

  $('#login').on('click', function () {
    login();
  });

  // 跳转首页
  $('#homepage').on('click', function () {
    window.location.href = 'http://web.lingjtx.com';
  });
</script>

</html>